1 using UnityEngine;
2 using
System.Collections;
3
4 public
class TouchToMouse : MonoBehaviour
5 {
6     
//Transform beingMoved;
7
8     
private void Update()
9     {
10         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
11         
foreach (Touch touch in Input.touches)
12         {
13             RaycastHit hit;
14             
if (!Physics.Raycast(ray, out hit)) continue;
15             
if (touch.phase == TouchPhase.Began)
16                 hit.transform.gameObject.SendMessage(
"OnMouseDown");
17         }
18     }
19 }


Gõ tìm kiếm nhanh...